Skip to content

Add Valve-220 map format support to quemap.#831

Merged
skies912 merged 10 commits into
mainfrom
feature/valve220-map-format
Jun 18, 2026
Merged

Add Valve-220 map format support to quemap.#831
skies912 merged 10 commits into
mainfrom
feature/valve220-map-format

Conversation

@skies912

Copy link
Copy Markdown
Collaborator

Auto-detects Valve-220 by peeking for '[' after the texture name; falls back to standard Q3 format if not present. Both formats are supported transparently with no flags required.


Ran into issues aligning faces in cavern - this helps. TB support for patch editing is coming too, which will also help alot.

Auto-detects Valve-220 by peeking for '[' after the texture name;
falls back to standard Q3 format if not present. Both formats are
supported transparently with no flags required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds transparent support for Valve-220 (“explicit texture axes”) brush-side texture mapping in quemap, auto-detecting Valve-220 syntax in .map files and adjusting texture vector generation accordingly to improve face alignment (e.g., in cavern).

Changes:

  • Detect Valve-220 brush-side syntax during map parsing by peeking for [ after the texture name.
  • Add a brush_side_t::valve flag and generate texture vectors differently when Valve-220 axes are present.
  • Print a simple “Map format” note during qbsp compilation based on whether any Valve-220 sides were detected.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/quemap/map.c Adds Valve-220 vs standard format detection and parsing for brush-side texture parameters.
src/quemap/map.h Extends brush_side_t with a valve flag indicating Valve-220 axis usage.
src/quemap/texture.c Adds Valve-220-specific texture vector handling using explicit axes.
src/quemap/qbsp.c Prints the detected map format after loading the map.

Comment thread src/quemap/texture.c Outdated
Comment thread src/quemap/map.c Outdated
Comment thread src/quemap/map.c Outdated
jdolan and others added 3 commits June 12, 2026 08:45
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jdolan

jdolan commented Jun 16, 2026

Copy link
Copy Markdown
Owner

This is great! But before we can merge it, we need to think this through.

What are the implications to the editor? Does it need to be able to write v220 .map? Does it actually Just Work because it uses raw string copies of the brushes to begin with?

Should we create a script that just converts all of our .maps to v220, if it's a superior format?

Do we need to adjust our TrenchBroom config to tell it that we support / prefer v220?

@skies912

skies912 commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

This is great! But before we can merge it, we need to think this through.

What are the implications to the editor? Does it need to be able to write v220 .map? Does it actually Just Work because it uses raw string copies of the brushes to begin with?

Should we create a script that just converts all of our .maps to v220, if it's a superior format?

Do we need to adjust our TrenchBroom config to tell it that we support / prefer v220?

  1. I just tested it. Seems to "just work". I even deleted the .map and let the editor replace it. One note: TB won't immediately recognize the newly written .map BUT it's cosmetic. // Format: Quake3 (Valve) is needed up top for 220 loading. After I changed it, map loads and compiles just fine after that.
  2. It's def a better format when it's needed. We -could- use a script to convert all the maps - it didn't take much on Claude's end to make a python script for it.
  3. Yes. Though it's a simple one liner in GameConfig.cfg:
"fileformats": [
        { "format": "Quake3" },
		{ "format": "Quake3 (Valve)" }
    ],

@jdolan

jdolan commented Jun 16, 2026

Copy link
Copy Markdown
Owner

I think you've actually got this one. You should go for it.

I would generate the script, version it in Quetoo's map-fu folder maybe? Or add it to map-fu itself? Then convert and rebake all .maps. And update the TrenchBroom and Radiant configs. I'll open a PR against TB proper for you once this is all working and merged.

You got this! 💪🏻😎

skies912 and others added 4 commits June 16, 2026 16:13
Detect Valve-220 brush sides by peeking for '[' after the texture name,
parse the explicit S/T texture axes into side->axis, and compute texture
vectors directly from those axes in TextureVectorsForBrushSide. Falls back
to standard Q1/Q3 shift/rotate/scale parsing otherwise. quemap reports the
detected format ("Quake3 (Valve)" vs "Quake3").

Re-homed onto current main; supersedes the stale
feature/valve220-map-format branch (fork point f708ff0).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
BSP tree and portal generation recurse to the depth of the BSP tree
(BuildTree_r, MakeTreePortals_r). On large maps the tree is deep enough
to overflow the default 1 MB Windows main-thread stack, crashing quemap
with an access violation in the portal pass (e.g. cavern.map). Linux and
macOS give the main thread ~8 MB by default, so this only affected the
Windows build. Set /STACK reserve to 8 MB to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@jdolan jdolan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there! We'll need a second PR in quetoo-data that updates scripts/map-fu to convert legacy to v220 as part of its preprocessing step. This will ensure that the Makefile in quetoo-data continues to function while also seamlessly updating the .map files.

<!-- BSP tree/portal generation recurses to tree depth; the default 1 MB Windows
main-thread stack overflows on large maps (e.g. cavern). Reserve 8 MB to match
the Linux/macOS main-thread default. -->
<StackReserveSize>8388608</StackReserveSize>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣 Oh, fucking Windows...

Comment thread Quetoo.xcodeproj/project.pbxproj
Comment thread src/quemap/map.h Outdated
/**
* @brief True if this brush side uses Valve-220 explicit texture axes.
*/
bool valve;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this boolean probably belongs as a global, right? We'd never encounter a .map file that uses some Valve brushes and some legacy / standard brushes, right?

Comment thread src/quemap/qbsp.c Outdated

LoadMapFile(map_name);

bool valve = false;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, what probably makes sense here is to introduce

typedef enum {
  MAP_QUAKE2,
  MAP_VALVE_220
} map_format_t;

And have LoadMapFile return the resolved format, which you can set a global to.

map_format = LoadMapFile(map_name);

And then everywhere downstream can just check map_format

Comment thread src/quemap/qbsp.c Outdated
break;
}
}
Com_Print("Map format: %s\n", valve ? "Quake3 (Valve)" : "Quake3");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Com_Verbose.

Comment thread src/quemap/texture.c Outdated
*/
void TextureVectorsForBrushSide(brush_side_t *side, const vec3_t origin) {

if (side->valve) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (map_format == MAP_VALVE_220) {

- Added an error path to map format selection to -make sure- mixed format .map files don't get processed. Even though it should never happen.
- also bumped the phone max face count because kept getting spam from quemap about my crystal clusters :|

@jdolan jdolan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo! Some super minor feedback, feel free to address, or not. This is approved.

<LocalDebuggerCommandArguments>-p "C:\Users\chrisg\OneDrive\Documents\My Games\Quetoo\default" -bsp test</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArgumentsHistory>-p "D:\quetoo_dev\github\quetoo\Quetoo.vs15\../../quetoo-data/src/default" -bsp -light tokays|-p "C:\Users\chrisg\OneDrive\Documents\My Games\Quetoo\default" -bsp test|-p "C:\Users\chrisg\OneDrive\Documents\My Games\Quetoo\default" -bsp longyard|-p "C:\Users\chrisg\OneDrive\Documents\My Games\Quetoo\default" -bsp maps/longyard|</LocalDebuggerCommandArgumentsHistory>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this whole file should be .gitignored? But I'm not going to lose sleep over it.

@skies912 skies912 Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we can just gitnore that ONE section (well ALL sections with "LocalDebugger*", that would be awesome - that seems to change each commit 👎 . The rest is relevant.

Comment thread src/quemap/face.c
}

#define MAX_VERTEX_FACES 32
#define MAX_VERTEX_FACES 64

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

64 faces sharing one vertex? You crazy bastard.. what're you doing?
Alt Text

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clusters of like this produced alot of warning spam in quemap - apparently didn't like verts so close together... SHUT UP. lol
image

Comment thread src/quemap/map.c Outdated
* @return The resolved map format, also stored in the global `map_format`.
*/
void LoadMapFile(const char *filename) {
int LoadMapFile(const char *filename) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uber-nit: should return the enum type here.

@skies912 skies912 merged commit 049cf7b into main Jun 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants